import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;

// 日志记录器
class Logger {
    private static final String LOG_FILE = "operation.log";

    public static void log(String operationType, String operator) {
        try (PrintWriter out = new PrintWriter(new FileWriter(LOG_FILE, true))) {
            String timestamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
            out.printf("[%s] 操作类型: %s, 操作人: %s%n", timestamp, operationType, operator);
        } catch (IOException e) {
            System.err.println("日志记录失败: " + e.getMessage());
        }
    }
}
